package DataBase;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;

public class GetDetailsDiscountOfTable {
	private String orderId;
	private Vector<String> details;
	
	public GetDetailsDiscountOfTable(String orderId)
	{
		this.orderId=orderId;
	}
	
	public Vector<String> getDetails()
	{
	    details = new Vector<String>();
		SQLConnection sc = new SQLConnection();
		try {

			PreparedStatement ps = sc.getConnection().prepareStatement("SELECT * FROM discount_table WHERE orderId = ?;");
			ps.setString(1,orderId );
			ResultSet rs = ps.executeQuery();

			ResultSetMetaData rsmd = rs.getMetaData();
			while (rs.next()) {
				details.add(rs.getString(1));
				details.add(rs.getString(2));
				details.add(rs.getString(3));
				
			}
			ps.close();
			 rs.close();
			 sc.getConnection().close();

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return details;
	}
	
}
